<include file="header"/>
<body>
<div class="wraper">
    <div class="lists">
        <div class="clearfix">
            <div class="img-box pull-left"><img src="{BEESCRM:$huserInfo['image_url']}"/></div>
            <div class="info pull-left">
                <p><span class="name">{BEESCRM:$huserInfo['real_name']}</span>
                    <if condition="$huserInfo.sex eq 1">男
                        <else/>女
                    </if>{BEESCRM:$huserInfo['user_age']}岁 {BEESCRM:$huserInfo['home_ownership']} ￥{BEESCRM:$huserInfo['wages']}元/天</p>
                <p>
                    <span class="iconfont icon-weibiaoti1 star"></span>
                    <span class="iconfont icon-weibiaoti1 star"></span>
                    <span class="iconfont icon-weibiaoti1 star"></span>
                    <span class="iconfont icon-weibiaoti1"></span>
                    <span class="iconfont icon-weibiaoti1"></span>
                    {BEESCRM:$huserInfo['work_experience']}年经验</p>
                <p>浙二医院</p>
            </div>
        </div>
        <div class="label-box block-top">
            <if condition="$huserInfo.type eq 1">
                <span class="label">全职</span>
                <else/>
                <span class="label">兼职</span>
            </if>
            <volist name="tags" id="vo">
                <span class="label label-blue">{BEESCRM:$vo} </span>
            </volist>
        </div>
    </div>
    <div class="info-container">
        <div class="form-box">
            <div class="form-list tb-mode">
                <p class="field tb-cell">陪护开始时间</p>
                <p class="area tb-cell"><input id="beginTime" placeholder="请选择开始时间" value="{BEESCRM:$beginTime}"/></p>
            </div>
            <div class="form-list tb-mode">
                <p class="field tb-cell">陪护结束时间</p>
                <p class="area tb-cell"><input id="endTime" placeholder="请选择结束时间" value="{BEESCRM:$endTime}"/></p>
            </div>
            <div class="form-list tb-mode">
                <p class="field tb-cell">病人情况</p>
                <!--<p class="area tb-cell"><input placeholder="" ></p>-->
            </div>
            <textarea placeholder="请简要描述待陪护病人情况" id="summary" ></textarea>
            <div class="form-list tb-mode">
                <p class="field tb-cell">联系人</p>
                <p class="area tb-cell"><input placeholder="" id="real_name"/></p>
            </div>
            <div class="form-list tb-mode">
                <p class="field tb-cell">联系电话</p>
                <p class="area tb-cell"><input type="tel" placeholder="" id="tel"/></p>
            </div>
            <!--<div class="form-list">
                <p class="text-right text-red">总费用：0元</p>
            </div>-->
           <!-- <p class="text-center xieyi"><span class="iconfont icon-selected"></span> 我同意《劳XXX》协议</p>-->
            <div id="datePlugin"></div>
        </div>
    </div>
    <a href="#" class="normal-btn">确认提交</a>
</div>
<div class="pop-box" id="recordInfo">
    <div class="main">
        <p class="iconfont icon-shenheshibai"></p>
        <div class="main-text">
            <p class="text-center"></p>
        </div>
    </div>
</div>

<div class="pop-box" id="passInfo">
    <div class="main">
        <p class="iconfont icon-chenggong"></p>
        <div class="main-text">
            <p class="text-center"></p>
        </div>
    </div>
</div>
<input type="hidden" value="{BEESCRM:$huserInfo['huser_id']}" id="huser_id">
<script src="/assets/park/huser/js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="/assets/park/huser/js/laydate.js"></script>
<script type="text/javascript">
    !function(){
        laydate.skin('molv');//切换皮肤，请查看skins下面皮肤库
    }();

    //日期范围限制
    var start = {
        elem: '#beginTime',
        format: 'YYYY-MM-DD',
        min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16', //最大日期
//        istime: true,
        istoday: false,
        choose: function(datas){
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };

    var end = {
        elem: '#endTime',
        format: 'YYYY-MM-DD',
        min: laydate.now(),
        max: '2099-06-16',
//        istime: true,
        istoday: false,
        choose: function(datas){
            start.max = datas; //结束日选好后，充值开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
</script>
<script>
    $('#recordInfo').hide();
    $('#passInfo').hide();
    $(function(){
        var height = $(window).height();
        var copyright = $('.copyright').outerHeight();
        $('.wraper').css("minHeight",height);
        $('.wraper').css("paddingBottom",copyright);

        $('#beginTime').date();
        $('#endTime').date();

        $('.foretab').on('click','.tab-list',function(){
            var idx = $(this).index();
            $(this).toggleClass('actived').siblings().removeClass('actived');
            $('.info-container').eq(idx).addClass('show').siblings().removeClass('show');
        })

        $(function () {
            //当点击跳转链接后，回到页面顶部位置
            $("#backtotop").click(function(){
                $('body,html').animate({scrollTop:0},300);
                return false;
            });
        });
    })
    $('.normal-btn').on('click',function(){
        var huser_id = $('#huser_id').val();
        var beginTime = $('#beginTime').val();
        var endTime = $('#endTime').val();
        var summary = $('#summary').val();
        var real_name = $('#real_name').val();
        var tel = $('#tel').val();

        $.ajax({
            url: "/Park/huser/addAppoint",
            type: "post",
            dataType: 'json',
            async: true,
            data:{huser_id:huser_id,start_time:beginTime,end_time:endTime,summary:summary,real_name:real_name,tel:tel},
            success: function (data) {
                if (data.err_code == 200) {
                    $('#passInfo').show();
                    $('#passInfo').find('.text-center').text(data.message);
                    setTimeout('location.href="/Park/huser/appointList"',2000)
                } else {
                    $('#recordInfo').show();
                    $('#recordInfo').find('.text-center').text(data.message);
                    setTimeout('info()',2000);
                }
            }
        });
    });

    //页面刷新
    function reload(){
        setTimeout('location.reload()',1500);
    }

    //提示信息
    function info()
    {
        $('#recordInfo').hide();
    }
</script>
</body>
</html>
